package cn.ljh.student.controller;

import cn.ljh.student.dto.Result;
import cn.ljh.student.pojo.User;
import cn.ljh.student.service.UserService;
import cn.ljh.student.utils.ResultUtils;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * 展示信息
 */
@RestController
public class Show {
    @Resource
    private UserService userService;

    @RequestMapping(value = "show",method = RequestMethod.GET)
    public Result<User> show() throws Exception {
        Map<String, Object> map = new HashMap<>();
        List<User> userList = userService.getUserListByMap(map);
        if (userList!=null){
            return ResultUtils.returnDataSuccess(userList);
        }else {
            return ResultUtils.returnSuccess("没有数据");
        }
    }
}
